/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.kiakaku.downloadpage;

import java.util.LinkedList;
import java.util.Queue;
import javax.management.Query;

/*
 *   File QueueNode is created by kiakaku on Mar 2, 2012 6:22:51 PM
 * If you want modify this file please insert information in here 
 * - Last modify in Mar 2, 2012, 6:22:51 PM by kiakaku
 *                  
 *
 * @author kiakaku
 */
public class QueueNode {

    private String url;
    private int dept;

    public QueueNode() {
        url = "";
        dept = -1;
    }

    public QueueNode(String url, int dept) {
        this.url = url;
        this.dept = dept;
    }

    public int getDept() {
        return dept;
    }

    public void setDept(int dept) {
        this.dept = dept;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public boolean equals(Object otherNode) {
        if (otherNode == null || !(otherNode instanceof QueueNode)) {
            return false;
        } else {
            QueueNode other = new QueueNode();
            other = (QueueNode) otherNode;
            return getUrl().equalsIgnoreCase(other.getUrl());
        }
    }

    public static void main(String[] args) {

        QueueNode[] arr = new QueueNode[10];
        Queue<QueueNode> q = new LinkedList<QueueNode>();
        for (int i = 0; i < 10; i++) {
            arr[i] = new QueueNode("abc", i);
            q.offer(arr[i]);
        }
        System.out.println(q.contains(arr[1]));
    }
}
